home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIBinaryOutputStream.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  10KB  |  283 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIBinaryOutputStream.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIBinaryOutputStream_h__
  6. #define __gen_nsIBinaryOutputStream_h__
  7.  
  8.  
  9. #ifndef __gen_nsIOutputStream_h__
  10. #include "nsIOutputStream.h"
  11. #endif
  12.  
  13. #ifndef __gen_nsrootidl_h__
  14. #include "nsrootidl.h"
  15. #endif
  16.  
  17. /* For IDL files that don't want to include root IDL files. */
  18. #ifndef NS_NO_VTABLE
  19. #define NS_NO_VTABLE
  20. #endif
  21.  
  22. /* starting interface:    nsIBinaryOutputStream */
  23. #define NS_IBINARYOUTPUTSTREAM_IID_STR "204ee610-8765-11d3-90cf-0040056a906e"
  24.  
  25. #define NS_IBINARYOUTPUTSTREAM_IID \
  26.   {0x204ee610, 0x8765, 0x11d3, \
  27.     { 0x90, 0xcf, 0x00, 0x40, 0x05, 0x6a, 0x90, 0x6e }}
  28.  
  29. /**
  30.  * This interface allows writing of primitive data types (integers,
  31.  * floating-point values, booleans, etc.) to a stream in a binary, untagged,
  32.  * fixed-endianness format.  This might be used, for example, to implement
  33.  * network protocols or to produce architecture-neutral binary disk files,
  34.  * i.e. ones that can be read and written by both big-endian and little-endian
  35.  * platforms.  Output is written in big-endian order (high-order byte first),
  36.  * as this is traditional network order.
  37.  *
  38.  * @See nsIBinaryInputStream
  39.  */
  40. class NS_NO_VTABLE nsIBinaryOutputStream : public nsIOutputStream {
  41.  public: 
  42.  
  43.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBINARYOUTPUTSTREAM_IID)
  44.  
  45.   /* void setOutputStream (in nsIOutputStream aOutputStream); */
  46.   NS_IMETHOD SetOutputStream(nsIOutputStream *aOutputStream) = 0;
  47.  
  48.   /* void writeBoolean (in PRBool aBoolean); */
  49.   NS_IMETHOD WriteBoolean(PRBool aBoolean) = 0;
  50.  
  51.   /* void write8 (in PRUint8 aByte); */
  52.   NS_IMETHOD Write8(PRUint8 aByte) = 0;
  53.  
  54.   /* void write16 (in PRUint16 a16); */
  55.   NS_IMETHOD Write16(PRUint16 a16) = 0;
  56.  
  57.   /* void write32 (in PRUint32 a32); */
  58.   NS_IMETHOD Write32(PRUint32 a32) = 0;
  59.  
  60.   /* void write64 (in PRUint64 a64); */
  61.   NS_IMETHOD Write64(PRUint64 a64) = 0;
  62.  
  63.   /* void writeFloat (in float aFloat); */
  64.   NS_IMETHOD WriteFloat(float aFloat) = 0;
  65.  
  66.   /* void writeDouble (in double aDouble); */
  67.   NS_IMETHOD WriteDouble(double aDouble) = 0;
  68.  
  69.   /**
  70.      * Write a NUL-terminated 8-bit char* string to a binary stream.
  71.      */
  72.   /* void writeStringZ (in string aString); */
  73.   NS_IMETHOD WriteStringZ(const char *aString) = 0;
  74.  
  75.   /**
  76.      * Write a NUL-terminated 16-bit PRUnichar* string to a binary stream.
  77.      */
  78.   /* void writeWStringZ (in wstring aString); */
  79.   NS_IMETHOD WriteWStringZ(const PRUnichar *aString) = 0;
  80.  
  81.   /**
  82.      * Write a NUL-terminated UTF8-encoded string to a binary stream, produced
  83.      * from a NUL-terminated 16-bit PRUnichar* string argument.
  84.      */
  85.   /* void writeUtf8Z (in wstring aString); */
  86.   NS_IMETHOD WriteUtf8Z(const PRUnichar *aString) = 0;
  87.  
  88.   /**
  89.      * Write an opaque byte array to a binary stream.
  90.      */
  91.   /* void writeBytes ([size_is (aLength)] in string aString, in PRUint32 aLength); */
  92.   NS_IMETHOD WriteBytes(const char *aString, PRUint32 aLength) = 0;
  93.  
  94.   /**
  95.      * Write an opaque byte array to a binary stream.
  96.      */
  97.   /* void writeByteArray ([array, size_is (aLength)] in PRUint8 aBytes, in PRUint32 aLength); */
  98.   NS_IMETHOD WriteByteArray(PRUint8 *aBytes, PRUint32 aLength) = 0;
  99.  
  100. };
  101.  
  102. /* Use this macro when declaring classes that implement this interface. */
  103. #define NS_DECL_NSIBINARYOUTPUTSTREAM \
  104.   NS_IMETHOD SetOutputStream(nsIOutputStream *aOutputStream); \
  105.   NS_IMETHOD WriteBoolean(PRBool aBoolean); \
  106.   NS_IMETHOD Write8(PRUint8 aByte); \
  107.   NS_IMETHOD Write16(PRUint16 a16); \
  108.   NS_IMETHOD Write32(PRUint32 a32); \
  109.   NS_IMETHOD Write64(PRUint64 a64); \
  110.   NS_IMETHOD WriteFloat(float aFloat); \
  111.   NS_IMETHOD WriteDouble(double aDouble); \
  112.   NS_IMETHOD WriteStringZ(const char *aString); \
  113.   NS_IMETHOD WriteWStringZ(const PRUnichar *aString); \
  114.   NS_IMETHOD WriteUtf8Z(const PRUnichar *aString); \
  115.   NS_IMETHOD WriteBytes(const char *aString, PRUint32 aLength); \
  116.   NS_IMETHOD WriteByteArray(PRUint8 *aBytes, PRUint32 aLength); 
  117.  
  118. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  119. #define NS_FORWARD_NSIBINARYOUTPUTSTREAM(_to) \
  120.   NS_IMETHOD SetOutputStream(nsIOutputStream *aOutputStream) { return _to SetOutputStream(aOutputStream); } \
  121.   NS_IMETHOD WriteBoolean(PRBool aBoolean) { return _to WriteBoolean(aBoolean); } \
  122.   NS_IMETHOD Write8(PRUint8 aByte) { return _to Write8(aByte); } \
  123.   NS_IMETHOD Write16(PRUint16 a16) { return _to Write16(a16); } \
  124.   NS_IMETHOD Write32(PRUint32 a32) { return _to Write32(a32); } \
  125.   NS_IMETHOD Write64(PRUint64 a64) { return _to Write64(a64); } \
  126.   NS_IMETHOD WriteFloat(float aFloat) { return _to WriteFloat(aFloat); } \
  127.   NS_IMETHOD WriteDouble(double aDouble) { return _to WriteDouble(aDouble); } \
  128.   NS_IMETHOD WriteStringZ(const char *aString) { return _to WriteStringZ(aString); } \
  129.   NS_IMETHOD WriteWStringZ(const PRUnichar *aString) { return _to WriteWStringZ(aString); } \
  130.   NS_IMETHOD WriteUtf8Z(const PRUnichar *aString) { return _to WriteUtf8Z(aString); } \
  131.   NS_IMETHOD WriteBytes(const char *aString, PRUint32 aLength) { return _to WriteBytes(aString, aLength); } \
  132.   NS_IMETHOD WriteByteArray(PRUint8 *aBytes, PRUint32 aLength) { return _to WriteByteArray(aBytes, aLength); } 
  133.  
  134. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  135. #define NS_FORWARD_SAFE_NSIBINARYOUTPUTSTREAM(_to) \
  136.   NS_IMETHOD SetOutputStream(nsIOutputStream *aOutputStream) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOutputStream(aOutputStream); } \
  137.   NS_IMETHOD WriteBoolean(PRBool aBoolean) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteBoolean(aBoolean); } \
  138.   NS_IMETHOD Write8(PRUint8 aByte) { return !_to ? NS_ERROR_NULL_POINTER : _to->Write8(aByte); } \
  139.   NS_IMETHOD Write16(PRUint16 a16) { return !_to ? NS_ERROR_NULL_POINTER : _to->Write16(a16); } \
  140.   NS_IMETHOD Write32(PRUint32 a32) { return !_to ? NS_ERROR_NULL_POINTER : _to->Write32(a32); } \
  141.   NS_IMETHOD Write64(PRUint64 a64) { return !_to ? NS_ERROR_NULL_POINTER : _to->Write64(a64); } \
  142.   NS_IMETHOD WriteFloat(float aFloat) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteFloat(aFloat); } \
  143.   NS_IMETHOD WriteDouble(double aDouble) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteDouble(aDouble); } \
  144.   NS_IMETHOD WriteStringZ(const char *aString) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteStringZ(aString); } \
  145.   NS_IMETHOD WriteWStringZ(const PRUnichar *aString) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteWStringZ(aString); } \
  146.   NS_IMETHOD WriteUtf8Z(const PRUnichar *aString) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteUtf8Z(aString); } \
  147.   NS_IMETHOD WriteBytes(const char *aString, PRUint32 aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteBytes(aString, aLength); } \
  148.   NS_IMETHOD WriteByteArray(PRUint8 *aBytes, PRUint32 aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteByteArray(aBytes, aLength); } 
  149.  
  150. #if 0
  151. /* Use the code below as a template for the implementation class for this interface. */
  152.  
  153. /* Header file */
  154. class nsBinaryOutputStream : public nsIBinaryOutputStream
  155. {
  156. public:
  157.   NS_DECL_ISUPPORTS
  158.   NS_DECL_NSIBINARYOUTPUTSTREAM
  159.  
  160.   nsBinaryOutputStream();
  161.  
  162. private:
  163.   ~nsBinaryOutputStream();
  164.  
  165. protected:
  166.   /* additional members */
  167. };
  168.  
  169. /* Implementation file */
  170. NS_IMPL_ISUPPORTS1(nsBinaryOutputStream, nsIBinaryOutputStream)
  171.  
  172. nsBinaryOutputStream::nsBinaryOutputStream()
  173. {
  174.   /* member initializers and constructor code */
  175. }
  176.  
  177. nsBinaryOutputStream::~nsBinaryOutputStream()
  178. {
  179.   /* destructor code */
  180. }
  181.  
  182. /* void setOutputStream (in nsIOutputStream aOutputStream); */
  183. NS_IMETHODIMP nsBinaryOutputStream::SetOutputStream(nsIOutputStream *aOutputStream)
  184. {
  185.     return NS_ERROR_NOT_IMPLEMENTED;
  186. }
  187.  
  188. /* void writeBoolean (in PRBool aBoolean); */
  189. NS_IMETHODIMP nsBinaryOutputStream::WriteBoolean(PRBool aBoolean)
  190. {
  191.     return NS_ERROR_NOT_IMPLEMENTED;
  192. }
  193.  
  194. /* void write8 (in PRUint8 aByte); */
  195. NS_IMETHODIMP nsBinaryOutputStream::Write8(PRUint8 aByte)
  196. {
  197.     return NS_ERROR_NOT_IMPLEMENTED;
  198. }
  199.  
  200. /* void write16 (in PRUint16 a16); */
  201. NS_IMETHODIMP nsBinaryOutputStream::Write16(PRUint16 a16)
  202. {
  203.     return NS_ERROR_NOT_IMPLEMENTED;
  204. }
  205.  
  206. /* void write32 (in PRUint32 a32); */
  207. NS_IMETHODIMP nsBinaryOutputStream::Write32(PRUint32 a32)
  208. {
  209.     return NS_ERROR_NOT_IMPLEMENTED;
  210. }
  211.  
  212. /* void write64 (in PRUint64 a64); */
  213. NS_IMETHODIMP nsBinaryOutputStream::Write64(PRUint64 a64)
  214. {
  215.     return NS_ERROR_NOT_IMPLEMENTED;
  216. }
  217.  
  218. /* void writeFloat (in float aFloat); */
  219. NS_IMETHODIMP nsBinaryOutputStream::WriteFloat(float aFloat)
  220. {
  221.     return NS_ERROR_NOT_IMPLEMENTED;
  222. }
  223.  
  224. /* void writeDouble (in double aDouble); */
  225. NS_IMETHODIMP nsBinaryOutputStream::WriteDouble(double aDouble)
  226. {
  227.     return NS_ERROR_NOT_IMPLEMENTED;
  228. }
  229.  
  230. /* void writeStringZ (in string aString); */
  231. NS_IMETHODIMP nsBinaryOutputStream::WriteStringZ(const char *aString)
  232. {
  233.     return NS_ERROR_NOT_IMPLEMENTED;
  234. }
  235.  
  236. /* void writeWStringZ (in wstring aString); */
  237. NS_IMETHODIMP nsBinaryOutputStream::WriteWStringZ(const PRUnichar *aString)
  238. {
  239.     return NS_ERROR_NOT_IMPLEMENTED;
  240. }
  241.  
  242. /* void writeUtf8Z (in wstring aString); */
  243. NS_IMETHODIMP nsBinaryOutputStream::WriteUtf8Z(const PRUnichar *aString)
  244. {
  245.     return NS_ERROR_NOT_IMPLEMENTED;
  246. }
  247.  
  248. /* void writeBytes ([size_is (aLength)] in string aString, in PRUint32 aLength); */
  249. NS_IMETHODIMP nsBinaryOutputStream::WriteBytes(const char *aString, PRUint32 aLength)
  250. {
  251.     return NS_ERROR_NOT_IMPLEMENTED;
  252. }
  253.  
  254. /* void writeByteArray ([array, size_is (aLength)] in PRUint8 aBytes, in PRUint32 aLength); */
  255. NS_IMETHODIMP nsBinaryOutputStream::WriteByteArray(PRUint8 *aBytes, PRUint32 aLength)
  256. {
  257.     return NS_ERROR_NOT_IMPLEMENTED;
  258. }
  259.  
  260. /* End of implementation class template. */
  261. #endif
  262.  
  263. inline nsresult
  264. NS_WriteOptionalStringZ(nsIBinaryOutputStream* aStream, const char* aString)
  265. {
  266.     PRBool nonnull = (aString != nsnull);
  267.     nsresult rv = aStream->WriteBoolean(nonnull);
  268.     if (NS_SUCCEEDED(rv) && nonnull)
  269.         rv = aStream->WriteStringZ(aString);
  270.     return rv;
  271. }
  272. inline nsresult
  273. NS_WriteOptionalWStringZ(nsIBinaryOutputStream* aStream, const PRUnichar* aString)
  274. {
  275.     PRBool nonnull = (aString != nsnull);
  276.     nsresult rv = aStream->WriteBoolean(nonnull);
  277.     if (NS_SUCCEEDED(rv) && nonnull)
  278.         rv = aStream->WriteWStringZ(aString);
  279.     return rv;
  280. }
  281.  
  282. #endif /* __gen_nsIBinaryOutputStream_h__ */
  283.